Primarily queried from relational databases, business-critical data is increasingly required to be exchanged and processed as either XML data, or a combination of XML data and relational data. However, using XML with relational databases has its challenges. For instance, each major database vendor provides XML extensions, but these extensions are different for each vendor and do not allow applications to be portable among databases. Some developers use XML standards (such as DOM, SAX, or StAX) in combination with database standards (such as ODBC or JDBC), but this approach requires developers to write and maintain large amounts of code.
Recognizing such challenges, the World Wide Web Consortium (W3C) developed XQuery (short for XML Query) as a uniform language for data exchange. In the same way that SQL provides a query language for relational databases, XQuery provides a common language for accessing XML data stores and any data that can be viewed as XML (such as relational data). Thus, the amount of code developers must write and maintain to use XML and relational data together is reduced. The W3C XQuery specification and its supporting documentation are herein incorporated by reference in their entirety. As are the XML Path Language (XPath) specification and its supporting documentation. XQuery uses XPath syntax to address specific parts of an XML document.
However, there is currently no mechanism that allows application developers to retrieve relational data as XML using both a standard query language and a standard API. Rather, application developers must rely on either home-grown solutions or on a vendor-specific combination of proprietary API (or API extensions) and a standard query language, like SQL/XML or XQuery.
What is needed, therefore, are techniques that allows application developers to retrieve relational data as XML using both a standard query language and a standard API.